package com.hotai.comment.pojo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.io.Serializable;
import java.util.Date;

@Table(name = "institution")
@Data
public class Institution implements Serializable {

	private static final long serialVersionUID = 2255390167380582218L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@TableId(type = IdType.AUTO)
	@Column(name = "id")
	private Integer id;

	/**
	 * 机构名称
	 */

	@NotBlank(message = "机构名称不能为空！")
	@Size(max = 50,min = 1)
	@Column(name = "name")
	private String name;

	/**
	 * 账号
	 */
	@Column(name = "account")
	private String account;

	/**
	 * 联系人
	 */
	@NotBlank(message = "机构名称不能为空！")
	@Size(max = 20,min = 1)
	@Column(name = "linkman")
	private String linkman;

	/**
	 * 手机号
	 */
	@Column(name = "phone")
	@Pattern(regexp = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$",message = "手机号码有误！")
	private String phone;


	/**
	 * 机构简称
	 */
	@NotBlank(message = "机构名称不能为空！")
	@Size(max = 50,min = 1)
	@Column(name = "jianame")
	private String jianame;


	/**
	 * 设备
	 */
	@Column(name = "equipment")
	private Integer equipment;

	/**
	 * 教师数量
	 */
	@Column(name = "teacher_num")
	private Integer teacherNum;

	/**
	 * 学生数量
	 */
	@Column(name = "student_num")
	private Integer studentNum;

	/**
	 * 状态
	 */
	@Column(name = "status")
	private Integer status;

	@Column(name = "create_date")

	@DateTimeFormat(pattern="yyyy-MM-dd")//存到数据库
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") //从数据库
	private Date createDate;

	/**
	 * 1.教师管理 2,学生管理 3.设备管理 4。数据报表
	 */
	@Column(name = "method")
	private Integer method;

	@Column(name = "deid")
	private Integer deid;


	@Column(name = "img")
	private String img;

	@Column(name = "denglu_date")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm")//存到数据库
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") //从数据库
	private Date dengluDate;

	@Column(name = "password")
	private String password;

}
